<?php
$username = $_POST["AdminName"];
$password = $_POST["Password"];
$time = date("Y-m-d",time());
$last = $_COOKIE["time"];
//这里图个方便写个匹配登录 后面要是可以改数据库吧

header("content-type:text/html;charset=utf-8");
$date1 = strtotime($last); 
$date2 = strtotime($time); 
$diff= $date2 - $date1 ;
$days =abs(round($diff / 86400));
if($day > 1) {
	header("Location:LoginError.html");
    exit();
}

$file = './admin/main/AddUser/UserList.txt';
$searchString = $username.$password;
$fileContent = file_get_contents($file);
if (strpos($fileContent, $searchString) !== false) {
    header("Location:LoginSuccess.php");
    setcookie("UserLogin","true",time()+60*60*24);
    setcookie("time",$time,time()+60*60*24);
    setcookie("username","$username",time()+60*60*24);
    exit();
} else {
    header("Location:LoginError.html");
    exit();
}
?>
